#define _CRT_SECURE_NO_WARNINGS  1
#include<stdio.h>
#include<stdlib.h>
typedef struct BiLNode
{
    char data;
    struct BiLNode* Left, * Right;
}BiLNode, * BiTree;
int Create(BiTree* bt);
void LevelorderTraversal(BiTree bt);
int main()
{
    BiTree bt;
    Create(&bt);
    LevelorderTraversal(bt);
    return 0;
}

int Create(BiTree* bt)
{
    char ch;
    scanf("%c", &ch);
    if (ch == '#')
        *bt = NULL;
    else
    {
        *bt = (BiTree)malloc(sizeof(BiLNode));
        if (*bt == NULL)
            return 0;
        (*bt)->data = ch;
        Create(&((*bt)->Left));
        Create(&((*bt)->Right));
    }
    return 1;
}
void LevelorderTraversal(BiTree bt)
{
    if (bt == NULL)
        return;
    BiTree Queue[20];
    int front = 0;
    int rear = 0;
    Queue[rear] = bt;
    rear = (rear + 1) % 100;
    while (front != rear)
    {
        printf("%c", Queue[front]->data);
        if (Queue[front]->Left != NULL)
        {
            Queue[rear] = Queue[front]->Left;
            rear = (rear + 1) % 100;
        }
        if (Queue[front]->Right != NULL)
        {
            Queue[rear] = Queue[front]->Right;
            rear = (rear + 1) % 100;
        }
        front = (front + 1) % 100;
    }
}